home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / pascal / dosfcall.zip / DOSFCALL.DOC
Text File  |  1988-12-30  |  1KB  |  48 lines

  1. {* WARNING WARNING WARNING WARNING WARNING WARNING WARNING
  2.  
  3.     Do not try to use the MsDos function call unless you are
  4.     very familiar with the operating system and have technical
  5.     information available to you!
  6.  
  7.    The following program uses the MsDos command in Turbo to
  8.    retrieve the system date.  This is achieved via DOS function
  9.    call 42 (or 2A hex).  The function call is placed in the AH
  10.    register according to the technical reference manual.
  11.  
  12.    Type in the following code.  The only output is the date
  13.    at the top of your screen.*}
  14.  
  15. program GetDate;
  16. type
  17.   DateStr = string[10];
  18.  
  19. function Date: DateStr;
  20. type
  21.   regpack = record
  22.               ax,bx,cx,dx,bp,si,di,ds,es,flags: integer;
  23.             end;
  24.  
  25. var
  26.   recpack:       regpack;                {record for MsDos call}
  27.   month,day:     string[2];
  28.   year:          string[4];
  29.   dx,cx:         integer;
  30.  
  31. begin
  32.   with recpack do
  33.   begin
  34.     ax := $2a shl 8;
  35.   end;
  36.   MsDos(recpack);                        { call function }
  37.   with recpack do
  38.   begin
  39.     str(cx,year);                        {convert to string}
  40.     str(dx mod 256,day);                     { " }
  41.     str(dx shr 8,month);                     { " }
  42.   end;
  43.   date := month+'/'+day+'/'+year;
  44. end;
  45.  
  46. begin
  47.   writeln(date);
  48. end.